<include file="Public:head" title="用户列表"/>
<div class="main-container" id="main-container">
    <div class="main-container-inner">
        <include file="Public:left" />
        <div class="main-content">
            <div class="breadcrumbs" id="breadcrumbs">
                <ul class="breadcrumb">
                    <li><i class="icon-home home-icon"></i><a href="__APP__/{$Think.MODULE_NAME}">首页</a></li>
                    <li><a>任务管理</a></li>
                    <li class="active">任务列表</li>
                </ul>
            </div>
            <div class="page-content">
                <div class="row">
                    <div class="col-xs-12">
                        <div class="row">
                            <div class="col-xs-12">
                                <div class="header smaller lighter blue">
                                    <div class="nav-search col-xs-10" id="nav-search">
                                        <form class="form-search" method="get" action="">
                                            <div class="search_area">
                                                <input class="form-control search-query" type="text" name="orderno" autocomplete="off"  placeholder="请输入订单编号" value="{$Think.get.orderno}">
                                                <select name="assignuid" id="assign_uid" autocomplete="off">
                                                    <option value="" >请选择指派用户</option>
                                                    <foreach name="adminlist" item="vo" key="k" >
                                                        <option value="{$vo.id}" <if condition="$Think.get.assignuid eq $vo.id "> selected</if> >{$vo.nickname}</option>
                                                    </foreach>
                                                </select>
                                                <select name="status" id="status" autocomplete="off" style="width:120px;">
                                                    <option value=""  >全部</option>
                                                    <option value="0" <if condition="$Think.get.status eq 0 "> selected</if> >新建</option>
                                                    <option value="1" <if condition="$Think.get.status eq 1 "> selected</if> >进行中</option>
                                                    <option value="2" <if condition="$Think.get.status eq 2 "> selected</if> >已解决</option>
                                                </select>
                                                <input class="form-control search-query" type="text" name="keyword" autocomplete="off"  placeholder="请输入关键字" value="{$Think.get.keyword}">
                                                <button class="btn btn-purple btn-sm" type="submit">搜 索 <i class="icon_search icon-on-right bigger-110"></i></button>
                                            </div>
                                        </form>
                                    </div>
                                    <div class='cl'></div>
                                </div>
                                <notempty name='tasklist'>
                                    <div class="table-responsive">
                                        <table id="sample-table-1" class="table table-striped table-bordered table-hover">
                                            <thead>
                                                <tr>
                                                    <th width='20px' class="center">序号</th>
                                                    <th style="width:120px;">任务名称</th>
                                                    <th style="width:60px;">订单编号</th>
                                                               <th style="width:60px;">商品</th>
                                                    <th style="width:80px;">qq</th>
                                                    <th style="width:80px;">电话</th>
                                                    <th style="width:120px;">指派给</th>
                                                    <th style="width:130px;">任务状态</th>
                                                    <th style="width:130px;">受理时间</th>
                                                    <th style="width:130px;">创建时间</th>
                                                    <th width="120px">操作</th>
                                                </tr>
                                            </thead>
                                            <tbody>
                                            <foreach name="tasklist" item="row">
                                                <tr>

                                                    <td class="center">{$row.id}</td>
                                                     <td style="text-align: left">{$row.task_name}</td>
                                                     <td style="text-align: left">{$row.order_no}</td>
                                                     <td style="text-align: left"><if condition="$row.goods_id gt 0"><a href="https://www.sucaihuo.com/source/{$row.goods_id}.html" target="_blank">{$row.goods_id}</a></if></td>
                                                     <td style="text-align: left">{$row.qq}</td>
                                                     <td style="text-align: left">{$row.mobile}</td>
                                                     <td style="text-align: left">{$row.nickname}</td>
                                                     <td style="text-align: left">{$row.status|getTaskstatus}</td>
                                                     <td style="text-align: left">{$row.processing_time}</td>
                                                     <td style="text-align: left">{$row.create_time}</td>
                                                     <td style="text-align: left">
                                                         <a href="{:U('Taskwork/taskdetails',array('id'=>$row['id']))}" class="btn btn-minier btn-yellow">查看任务</a>
                                                         <a href="{:U('Taskwork/edittask',array('id'=>$row['id']))}" class="btn btn-minier btn-success">编辑任务</a>
                                                         <a onclick="deltask(this,{$row.id})" class="btn btn-minier btn-pink">删除</a>
<!--                                                         <button type="button" class="btn btn-sm btn-danger" data-toggle="button">Small</button>-->


                                                     </td>

                                                </tr>
                                            </foreach>
                                            </tbody>
                                        </table>

                                    </div>
                                    <div id="grid-pager" class="ui-state-default  ui-corner-bottom" dir="ltr">
                                        <table width='100%' data-table='user'  id='modal_del_table'>
                                            <tr>
                                                <td>
<!--                                                    <div class="visible-md visible-lg hidden-sm hidden-xs action-buttons">
                                                        <a class="purple" href="{:U('User/detail')}" data-rel="tooltip" data-original-title="用户添加">
                                                            <i class="icon-plus-sign bigger-130"></i>
                                                        </a>
                                                        <a class="red" data-toggle="modal" onclick="targetDelTable(0)"  data-rel="tooltip" data-original-title="批量删除">
                                                            <i class="icon-trash bigger-130"></i>
                                                        </a>
                                                    </div>-->
                                                </td>
                                                <td class='td_pager'><div class='pager'>{$page}</div></td>
                                            </tr>
                                        </table>
                                    </div>
                                    <else/>
                                    <p class='noempty'>没有符合条件的记录,立即<a href="{:U('Taskwork/addtask')}">添加</a></p>
                                </notempty>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <include file="Public:setting" />
    </div>
</div>

<include file="Public:foot" />
<script type="text/javascript" src="/Public/plugins/layer/layer.js"></script>
<script type="text/javascript">
    // function changeUserStatus(uid,status) {
    //
    //
    //
    //     $.post(getUrl('Ajax/changeUserStatus'), {uid:uid, status:status}, function(data) {
    //
    //     }, "json")
    //
    // }
    function showLoginError(tip) {
        $("#notice_error").text(tip).show();
        $("#notice_error").fadeOut(2500);
    }

    function deltask(obj,id) {
        layer.confirm('您确定要删除吗？', {
            btn: ['确定','取消'] //按钮
        }, function(){

            $.ajax({
                url:"{:U('Taskwork/deltask')}",
                type:'POST', //GET
                async:true,    //或false,是否异步
                data:{
                    id:id,
                },
                timeout:5000,    //超时时间
                dataType:'json',    //返回的数据格式：json/xml/html/script/jsonp/text
                beforeSend:function(xhr){
                    var index = layer.load()
                },
                success:function(data,textStatus,jqXHR){
                    if(data.code == 200) {
                        layer.closeAll();
                        $(obj).parent().parent().remove();
                        layer.msg(data.msg);
                    }else{
                        layer.closeAll()
                        layer.msg(data.msg);
                    }
                },
                error:function(xhr,textStatus){
                    // console.log('error')
                    // console.log(xhr)
                    // console.log(textStatus)
                },
                complete:function(){
                    // console.log('end')
                }
            });
        }, function(){
            layer.msg('您取消了操作', {
                time: 20000, //20s后自动关闭
            });
        });
    }
</script>